package com.easyattendance.model;

import java.util.Comparator;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "TBL_MATERIAL_SECTION")
@IdClass(MaterialSectionPK.class)
public class MaterialSection{
	
	@Id
	@GenericGenerator(name="material_id",strategy="foreign")
	@Column(name = "material_id",length=10,nullable=false)
	private String material_id;
	
	@Id
	@Column(name = "section_id",length=15,nullable=false)
	private String section_id;

	/* Many to one mappings of Material Section*/

	@ManyToOne
	@JoinColumn(name = "section_id",insertable=false,updatable=false)
	private Section section;
	
	@ManyToOne
	@JoinColumn(name = "class_id",nullable=true)
	private Class classObj;

	@ManyToOne
	@JoinColumn(name = "material_id",insertable=false,updatable=false)
	private Material material;
	

	public MaterialSection()
	{
		
	}

	public MaterialSection(String material_id, String section_id) {
		super();
		this.material_id = material_id;
		this.section_id = section_id;
	}
	
	

	public String getMaterial_id() {
		return material_id;
	}

	public void setMaterial_id(String material_id) {
		this.material_id = material_id;
	}

	public String getSection_id() {
		return section_id;
	}

	public void setSection_id(String section_id) {
		this.section_id = section_id;
	}

	public Section getSection() {
		return section;
	}

	public void setSection(Section section) {
		this.section = section;
	}

	public Class getClassObj() {
		return classObj;
	}

	public void setClassObj(Class classObj) {
		this.classObj = classObj;
	}

	public Material getMaterial() {
		return material;
	}

	public void setMaterial(Material material) {
		this.material = material;
	}
	
}

